package com.joven.shelltest.controller;

import com.joven.shelltest.service.RedisConditionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author wzj
 * @Date 2023-08-17 11:32
 **/
@RestController
@RequestMapping("/joven")
public class RedisConditionController {

    @Autowired
    private RedisConditionService redisConditionService;

    /**
     * list分页查询
     * @param current /
     * @param size /
     * @return /
     */
    @GetMapping("/page")
    public Map<String,Object> page(@RequestParam("current") int current, @RequestParam("size") int size){
        Map<String, Object> stringObjectMap;
        try {
            stringObjectMap = redisConditionService.productListPage(current, size);
        } catch (InterruptedException e) {
            stringObjectMap = new HashMap<>(16);
        }
        return stringObjectMap;
    }

}
